import pandas as pd


def signal(df: pd.DataFrame, *args, **kwargs) -> pd.DataFrame:
    n: int = args[0]
    factor_name: str = kwargs.get('column', __name__)
    df.sort_values(by='open_time', inplace=True)
    df[factor_name] = (df.groupby(['symbol', 'trade_type'])['quote_asset_volume'].
                       rolling(n, min_periods=1).mean().reset_index(level=[0, 1], drop=True))
    return df
